package com.ruoyi.device.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.mapper.GraphicsLibraryMapper;
import com.ruoyi.device.domain.GraphicsLibrary;
import com.ruoyi.device.service.IGraphicsLibraryService;

import static com.ruoyi.common.security.utils.SecurityUtils.getLoginUser;

/**
 * 图元图形库Service业务层处理
 * 
 * @author li
 * @date 2025-09-19
 */
@Service
public class GraphicsLibraryServiceImpl implements IGraphicsLibraryService 
{
    @Autowired
    private GraphicsLibraryMapper graphicsLibraryMapper;

    /**
     * 查询图元图形库
     * 
     * @param id 图元图形库主键
     * @return 图元图形库
     */
    @Override
    public GraphicsLibrary selectGraphicsLibraryById(Long id)
    {
        return graphicsLibraryMapper.selectGraphicsLibraryById(id);
    }

    /**
     * 查询图元图形库列表
     * 
     * @param graphicsLibrary 图元图形库
     * @return 图元图形库
     */
    @Override
    public List<GraphicsLibrary> selectGraphicsLibraryList(GraphicsLibrary graphicsLibrary)
    {
        return graphicsLibraryMapper.selectGraphicsLibraryList(graphicsLibrary);
    }

    /**
     * 新增图元图形库
     * 
     * @param graphicsLibrary 图元图形库
     * @return 结果
     */
    @Override
    public int insertGraphicsLibrary(GraphicsLibrary graphicsLibrary)
    {
        graphicsLibrary.setCreateBy(getLoginUser().getUsername());
        graphicsLibrary.setCreateTime(DateUtils.getNowDate());
        return graphicsLibraryMapper.insertGraphicsLibrary(graphicsLibrary);
    }

    /**
     * 修改图元图形库
     * 
     * @param graphicsLibrary 图元图形库
     * @return 结果
     */
    @Override
    public int updateGraphicsLibrary(GraphicsLibrary graphicsLibrary)
    {
        graphicsLibrary.setUpdateBy(getLoginUser().getUsername());
        graphicsLibrary.setUpdateTime(DateUtils.getNowDate());
        return graphicsLibraryMapper.updateGraphicsLibrary(graphicsLibrary);
    }

    /**
     * 批量删除图元图形库
     * 
     * @param ids 需要删除的图元图形库主键
     * @return 结果
     */
    @Override
    public int deleteGraphicsLibraryByIds(Long[] ids)
    {
        return graphicsLibraryMapper.deleteGraphicsLibraryByIds(ids);
    }

    /**
     * 删除图元图形库信息
     * 
     * @param id 图元图形库主键
     * @return 结果
     */
    @Override
    public int deleteGraphicsLibraryById(Long id)
    {
        return graphicsLibraryMapper.deleteGraphicsLibraryById(id);
    }
}
